package com.family.gmall.item.controller;

import com.family.gmall.common.result.Result;
import com.family.gmall.item.service.ItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * @Auther: family
 * @Date: 2023/7/14 08:48
 * @Description:
 */
@Api(tags = "商品详情")
@RestController
@RequestMapping("/api/item")
public class ItemApiController {

    @Resource
    private ItemService itemService;

    @ApiOperation("获取商品详情")
    @ApiImplicitParam(name = "skuId", value = "skuId", required = true)
    @GetMapping("/{skuId}")
    public Result getItem(@PathVariable Long skuId) {
        return Result.ok(itemService.getItemBySkuId(skuId));
    }
}
